<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head th:include="common_include :: commonHead('部门编辑')"/>
<link href="/libs/iCheck/custom.css" th:href="@{/libs/iCheck/custom.css}" rel="stylesheet"/>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
                <input id="rowKey" name="rowKey" type="hidden" th:field="*{rowKey}"/>
                <input id="pid" name="pid" type="hidden" th:field="*{pid}"/>
                <div class="form-group">
                    <label class="col-sm-3 control-label ">上级部门</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" id="treeName" readonly="true"
                               th:value="${parentName}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">部门名称</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" name="deptName" id="deptName" th:field="*{deptName}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">负责人</label>
                    <div class="col-sm-8">
                        <input id="leader" name="leader" class="form-control" type="text" th:field="*{leader}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">联系电话</label>
                    <div class="col-sm-8">
                        <input id="phone" name="phone" class="form-control" type="text" th:field="*{phone}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">电子邮箱</label>
                    <div class="col-sm-8">
                        <input id="email" name="email" class="form-control" type="email" th:field="*{email}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">联系地址</label>
                    <div class="col-sm-8">
                        <input id="address" name="address" class="form-control" type="text" th:field="*{address}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">显示排序</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="number" name="sortNumber" th:field="*{sortNumber}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">部门状态</label>
                    <div class="col-sm-8"
                         th:with="dicts=${@dictCode.selectDictCodeByType('sys_normal_disable')}">
                        <div th:each="dict : ${dicts}" th:class="${dict['cssStyle']}">
                            <input type="radio" th:id="${dict['codeValue']}" name="deptStatus" th:value="${dict['codeValue']}"
                                   th:field="*{deptStatus}"/>
                            <label th:for="${dict['codeValue']}" th:text="${dict['codeText']}"></label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">备注</label>
                    <div class="col-sm-8">
                        <input id="deptRemark" name="deptRemark" class="form-control" type="text" th:field="*{deptRemark}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">模块名称</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" name="moduleName"  th:field="*{moduleName}">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<head th:include="common_include :: commonFoot"/>
<script th:src="@{/libs/iCheck/icheck.min.js}"></script>
<script>
    var prefix = ctx + "upms/dept"

    $("#form-dept-edit").validate({
        rules: {
            deptName: {
                required: true,
            },
            sortNumber: {
                required: true,
                digits: true,
            },
        },
        submitHandler: function (form) {
            $.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
        }
    });

    function submitClick() {
        if ($('#form-dept-edit').valid()) {
            $('#form-dept-edit').submit()
        }
    }
</script>
</body>
</html>